]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-app: Consider desktop actions in can_open_new_window()
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 6 Aug 2019 11:19:59 +0000 (13:19 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 6 Aug 2019 13:04:24 +0000 (15:04 +0200)
We currently only consider a remote "app.new-window" action when running,
but not a fixed "new-window" action in the .desktop file. The latter is
clearly useful as well, in particular as open_new_window() already does,
so add it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/665

src/shell-app.c

index b8fd9384fa1b4f23d5e75a205488eed8f71ee70e..7968e3358fbda44972ed0d8dbbd04897f8db93f6 100644 (file)
@@ -601,6 +601,8 @@ shell_app_can_open_new_window (ShellApp *app)
 {
   ShellAppRunningState *state;
   MetaWindow *window;
+  GDesktopAppInfo *desktop_info;
+  const char * const *desktop_actions;
 
   /* Apps that are not running can always open new windows, because
      activating them would open the first one */
@@ -619,12 +621,18 @@ shell_app_can_open_new_window (ShellApp *app)
   if (!app->info)
     return FALSE;
 
+  desktop_info = G_DESKTOP_APP_INFO (app->info);
+
   /* If the app is explicitly telling us, then we know for sure */
-  if (g_desktop_app_info_has_key (G_DESKTOP_APP_INFO (app->info),
-                                  "X-GNOME-SingleWindow"))
-    return !g_desktop_app_info_get_boolean (G_DESKTOP_APP_INFO (app->info),
+  if (g_desktop_app_info_has_key (desktop_info, "X-GNOME-SingleWindow"))
+    return !g_desktop_app_info_get_boolean (desktop_info,
                                             "X-GNOME-SingleWindow");
 
+  /* If it has a new-window desktop action, it should be able to */
+  desktop_actions = g_desktop_app_info_list_actions (desktop_info);
+  if (desktop_actions && g_strv_contains (desktop_actions, "new-window"))
+    return TRUE;
+
   /* If this is a unique GtkApplication, and we don't have a new-window, then
      probably we can't